﻿namespace LiteBlog.Common.Entities
{
    using LiteBlog.Common.Enums;
    using System;

    public class ServiceItem
    {
        public FrequencyType FrequencyType { get; set; }
        public int Frequency
        {
            get
            {
                switch (FrequencyType)
                {
                    case FrequencyType.Daily:
                        return 1;
                    case FrequencyType.Weekly:
                        return 7;
                    case FrequencyType.Monthly:
                        return 30;
                    default:
                        return 1;
                }
            }
        }
        public string Id { get; set; }
        public DateTime LastUpdated { get; set; }
        public string Method { get; set; }
        public DateTime NextUpdate
        {
            get
            {
                return LastUpdated.AddDays(Frequency);
            }
        }

        public string Path { get; set; }
        public string Type { get; set; }
    }
}